< previous page page_285 next page >

Page 285
SELECT COUNT(Units) AS UnitCount,
   AVG(Units) AS UnitAvg,
   SUM(Units) AS UnitSum,
   MIN(Units) AS UnitMin,
   MAX(Units) AS UnitMax
   FROM BookSales
   WHERE Qtr = 1
0285-01.jpg
Figure 8.16.
Using the 
WHERE clause to limit
the scope of aggregate functions.
Using Visual Basic Functions in a SELECT Statement
When you call the Microsoft Access Jet database engine from within a Visual Basic program, you can use any valid Visual Basic functions as part of the SQL statement. For example, if you want to create a result set with a column that holds only the first three characters of a field in the underlying table, you could use the Visual Basic Left$ function as part of your column list in the SELECT_FROM statement, in the following line (see Figure 8.17):
SELECT Left$(Name,3), Name
   FROM Authors
0285-02.jpg
Figure 8.17.
Using Visual Basic functions in an SQL statement.

 
< previous page page_285 next page >

If you like this book, buy it!